#ifndef TCPRECEIVER_H
#define TCPRECEIVER_H

#include <QTcpSocket>
#include <QThread>
#include <QHostAddress>

#define BUF_SIZE 4096

class TcpReceiver : public QTcpSocket
{
	Q_OBJECT
	public:
		TcpReceiver();
		virtual ~TcpReceiver();
		bool Initialize(int socketDescriptor);

	protected:
		virtual void OnInitialization();
		virtual void OnReadStream(const char *s, int len);

	public slots:
		void OnSocketError(QAbstractSocket::SocketError err);
		void SocketState(QAbstractSocket::SocketState state);
		void ReadStream();

	protected slots:
		virtual void OnDisconnected();

	protected:
		QThread *_thread;
		QHostAddress _addr;
};

#endif // TCPRECEIVER_H
